/*
*Copyright 2021-2023 NERCIS
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/

package cn.ac.nercis.pes.common.constant.evaluation;

import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 测评标识
 * @author zpy
 * @version 1.0.0
 */
public enum EvaluationTag {
    /**是**/
    YES("是",true),
    NO("否",false);

    public static List<String> findTags(){
        return Stream.of(YES,NO)
                .map(EvaluationTag::getName)
                .collect(Collectors.toList());
    }

    public static EvaluationTag fromName(String name){
        return Stream.of(EvaluationTag.values())
                .filter(et-> StringUtils.equals(et.getName(),name))
                .findFirst()
                .orElse(EvaluationTag.YES);
    }

    private String name;
    private Boolean value;

    EvaluationTag(String name, Boolean value){
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public Boolean getValue() {
        return value;
    }
}